import Vue from "vue";

import App from "./App.vue";

import UsersIndex from "./UsersIndex.vue";
import UsersAdd from "./UsersAdd.vue";
import UsersEdit from "./UsersEdit.vue";
import NotFound from "./NotFound.vue";

import VueRouter from "vue-router";

Vue.use(VueRouter); //插件

const router = new VueRouter({
  routes: [
    {
      path: "/users/index",
      component: UsersIndex,
    },
    {
      path: "/users/add",
      component: UsersAdd,
    },
    {
      path: "/users/edit",
      component: UsersEdit,
    },

    {
      path: "*", //匹配一切
      component: NotFound,
    },
  ],
});

new Vue({
  render: (h) => h(App),
  router, //路由注入
}).$mount("#app");
